package com.kaiwukj.android.ufamily.utils;

public class DoubleClickHelper {

    private static final long ruleMs = 800;
    private static long lastMs = 0;
    private static String lastTag = "";

    public static boolean isDoubleClick() {
        boolean flag = false;
        long sMs = System.currentTimeMillis();
        if (lastMs > 0 && sMs - lastMs < ruleMs) {
            flag = true;
        }
        lastMs = sMs;
        return flag;
    }

    public static boolean isDoubleClick(String tag) {
        boolean flag = false;
        if (lastTag.equals(tag)) {
            flag = isDoubleClick();
        }
        lastTag = tag;
        return flag;
    }
}
